public class eg4_6Student {
    private String name;
    private int num;
    private int englishGrade;
    static String className = "Computer Class1";
    static String errorMessage = "";
    private static int counter = 0;

    public eg4_6Student() {
        counter = counter + 1;
        this.num = counter;
        checkNum();
    }

    public eg4_6Student(String name) {
        this.name = name;
        counter = counter + 1;
        this.num = counter;
        checkNum();
    }

    public eg4_6Student(String name, int num, int englishGrade) {
        this.name = name;
        this.num = num;
        this.englishGrade = englishGrade;
        checkNum();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public int getEnglishGrade() {
        return englishGrade;
    }

    public void setEnglishGrade(int englishGrade) {
        this.englishGrade = englishGrade;
    }

    public static int getCounter() {
        return counter;
    }

    public static void setCounter(int aCounter) {
        counter = aCounter;
    }

    public static void doHomework() {
        System.out.println("I am doing my Homework in " + className);
    }

    private void checkNum() {
        if (this.num > 50) errorMessage = errorMessage + "The num " + this.num + " is out of range. His or her name is " +
                this.name + ".\n";
    }
}